<template>
  <div class="mod-config">
    <table-view ref="view"
                :searchAttrs="searchAttrs"
                :primaryKey="primaryKey"
                :listApiName="listApiName"
                :deleteApiName="deleteApiName"
                :saveAuthName="saveAuthName"
                :deleteAuthName="deleteAuthName"
                :exportApiName="exportApiName"
                :showAttrs="showAttrs"
                :templateDownloadApiName="templateDownloadApiName"
                :importApiName="importApiName"
                :sumInfo='sumInfo'
    >
    </table-view>
    <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
  </div>
</template>

<script>
import AddOrUpdate from './financePay-add-or-update'
import tableView from '@/components/tableView'
import basicMixins from '@/utils/commonViewMixins'

export default {
  mixins: [basicMixins],
  data() {
    return {
      searchAttrs: {
        purchaseContractNo: {
          placeholder: '采购合同'
        },
        supplierId: {
          label: '供应商名称',
          clearable: true,
          type: 'autoComplete',
          placeholder: '请输入供应商名称',
          querySearchApiName: 'supplierApi/getSupplierList'
        },
        dateTimeRange: {
          type: 'date',
          dateType: 'daterange',
          clearable: true
        }
        // payAccount: {
        //   placeholder: '支出账户',
        //   type: 'list',
        //   clearable: true,
        // }
      },
      showAttrs: {
        payAccount: {
          label: '支出账户',
          type: 'radio',
          items: [
            {text: '公户（人民币）', value: 1},
            {text: '公户（美元）', value: 2},
            {text: '个人（人民币）', value: 3},
            {text: '个人（美元）', value: 4},
          ]

        },
        categoryName: {label: '支出类别'},
        purchaseContractNo: {
          label: '采购合同',
          width: 140,
          type: 'linkLabel',
          searchKey: 'purchaseContractNo',
          routerName: 'contract-contractpurchaseinfo'
        },
        // price: {label: '单价'},
        amount: {
          label: '支付金额',
          type: 'money',
          max: 2000000
        },
        supplierName: {label: '供应商名称', width: 160},
        payDate: {
          label: '付款日期',
          type: 'date'
        },
        payInfo: {label: '打款信息'},
        remark: {label: '备注'},
        status: {
          label: '状态',
          type: 'radio',
          items: [
            {value: 0, text: '禁用', tagType: 'danger'},
            {value: 1, text: '正常'}
          ]
        }
      },
      sumInfo: {amount: 'amount'},
      primaryKey: 'id',
      listApiName: 'financeApi/listFinancePay',
      deleteApiName: 'financeApi/deleteFinancePay',
      saveAuthName: 'finance:financepay:save',
      deleteAuthName: 'finance:financepay:delete',
      templateDownloadApiName: 'financeApi/templateDownloadFinancePay',
      importApiName: 'financeApi/importFinancePay',
      exportApiName: 'financeApi/getFinancePayExport'

    }
  },
  components: {
    AddOrUpdate,
    tableView
  }
}
</script>
